#ifndef __THREADING_HPP__
#define __THREADING_HPP__

#include <iostream>
#include <sstream>
#include <string>
#include <mutex>
#include <thread>

#include <numa.h>
#include <numaif.h>
#include <linux/sched.h>

class Threading {
  static inline std::mutex &display_mutex() {
    static std::mutex the_mutex;
    return the_mutex;
  }
  static inline std::mutex &count_mutex() {
    static std::mutex the_mutex;
    return the_mutex;
  }
  static inline void dump(std::ostream & os, std::string const &s) {
    display_mutex().lock();
    os << s;
    display_mutex().unlock();
  }
 
public:
  static void dumpThreadInfo(std::ostream & os, std::string const &s);
  static void dumpMemInfo(std::ostream & os, void *addr);
};
#endif // __THREADING_HPP__
